<Widget:show col="12" bdcls="no-padding" title="修改数据">
<form method="post" submit-ajax action="{$updateUrl}">
<input type="hidden" name="id" value="{$vo.id}">
<input type="hidden" name="model" value="{$model}">
<table class="table table-bordered">
    <volist name="cm[fields]" id="f">
    <tr >
        <notin name="f[name]" value="id">
        <eq name="f[showAdd]" value="1">
            <td width="180" style="text-align:right">{$f.label}</td>
            <td >
            {:ipt($f,$vo[$f['name']])}
            </td>
        </eq>
        </notin>
    </tr>
    </volist>
    <tr>
        <td colspan="2">
        <button class="btn btn-primary" type="submit">保存</button>
    <a class="btn btn-default" href="{:U("AcData/index?model=$model")}">取消</a>
        </td>
    </tr>
</table>

</form>
</Widget:show>

<script type="text/javascript">
var dialog;
var fileName = '';
$(function(){
    UM.getEditor('umeditor');

    var box = $('<div style="max-height:500px;overflow-y: auto;" class="row"></div>');
    var url = "{:U('AcFile/upfile')}";
    dialog = new BootstrapDialog({
        message: '',
        size:'size-wide',
        title:'文件上传',
        buttons: [{
            label: '首页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.frist').click();
            }
        },{
            label: '上一页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.prep').click();
            }
        },{
            label: '下一页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.next').click();
            }
        },{
            label: '取消',
            action: function(dialogRef){
                dialogRef.close();
            }
        }]
    });
    $('.btn-file').on('click',function(event){
        event.preventDefault();
        box.load(url,function(req){
            dialog.setMessage($(req));
            dialog.open();
        });
        fileName = $(this).data('file-name');
    })

    $('.btn-file-pre').on('click',function(event){
        event.preventDefault();
        var f = $(this).data('file-name');
        var src = $('[name='+f+'_ipt]').val();
        if (!src) {
            $.bootstrapGrowl('还没有选择文件');
        }else {
            BootstrapDialog.show({
                message: $('<img src>').attr('src',src),
            });
        }
    })
})

function selectFiled(url,id,name) {
    dialog.close();
    $('[name='+fileName+'_ipt]').val(url);
    $('.'+fileName+'_url').val(url);
    $('.'+fileName+'_id').val(id);
    $('.'+fileName+'_name').val(name);
    return false;
}

</script>
